package com.supinfo.bonjoursupinfo.activities;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Window;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.supinfo.bonjoursupinfo.R;
import com.supinfo.bonjoursupinfo.component.photoview.PhotoView;

public class SinglePhotosViewerActivity extends FragmentActivity {

	public static final String EXTRA_URL = "url";
	public static final String EXTRA_TITLE = "title";
	public static final String EXTRA_DESC = "description";

	private String url;
	private String title;
	private String desc;

	private PhotoView photoView;
	private TextView tvDesc;
	private TextView tvTitle;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.single_photos_viewer);

		photoView = (PhotoView) findViewById(R.id.photoView);
		tvDesc = (TextView) findViewById(R.id.tvDesc);
		tvTitle = (TextView) findViewById(R.id.tvTitle);

		url = this.getIntent().getExtras().getString(EXTRA_URL);
		title = this.getIntent().getExtras().getString(EXTRA_TITLE);
		desc = this.getIntent().getExtras().getString(EXTRA_DESC);
		
		tvTitle.setText(title);
		tvDesc.setText(desc);
		ImageLoader.getInstance().displayImage(url, photoView);
	}
}
